/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2019-2023. All rights reserved.
 * Description: callback function for memory hardware error caused panic
 * Author: Lv Ying
 * Create: 2019-06-19
 */
#ifndef _EULEROS_RAS_MEM_OFFLINE_H
#define _EULEROS_RAS_MEM_OFFLINE_H

#define NO_NOTIFIER_TO_ERROR 1

#ifdef CONFIG_EULEROS_RAS_MEM_OFFLINE_NOTIFY
int fma_notifier_to_errno(int *flags, unsigned long pfn);
extern int fma_register_memory_offline_notifier(struct notifier_block *nb);
extern void fma_unregister_memory_offline_notifier(struct notifier_block *nb);
extern int fma_memory_offline_notify(unsigned long event, void *v);
extern int recover_original_flag(int flags);
extern int fma_memory_offline_type(int flags);
enum fma_mem_offline_notify_types {
	FMA_MEM_OFFLINE_NOTIFY_PAGE = 0,
	FMA_MEM_OFFLINE_NOTIFY_INJECT,
	FMA_MEM_OFFLINE_NOTIFY_SRAO,
	FMA_MEM_OFFLINE_NOTIFY_SRAR,
	FMA_MEM_OFFLINE_NOTIFY_COUNT
};
#else
static inline int fma_notifier_to_errno(int *flags, unsigned long pfn)
{
	return NO_NOTIFIER_TO_ERROR;
}
#endif
#endif
